<template>
  <div id="oldNewsViewMore">
    <van-nav-bar title="查看更多" left-arrow @click-left="onClickLeft" fixed />
    <div class="news-details">
      <p class="title-style">{{viewDetailList.subject}}</p>
      <div class="label-text">   
          <p class="releaseTime">发布时间： {{viewDetailList.creationDate}}</p>
          <p class="source">来源： {{viewDetailList.neighborhoodName}}</p>
      </div>
      <div class="title-img" v-if="viewDetailList.headImage">
          <img v-lazy='viewDetailList.headImage' :key="viewDetailList.headImage">
      </div>
      <div class="news-content" :class="agedContent" v-html="viewDetailList.content">{{viewDetailList.content}}</div>
    </div>
  </div>
</template>
<script>
import api from "@/controller/agedService.js";
import constant from "@/controller/constant.js";
export default {
  name: "oldNewsViewMore",
  data() {
    return {
      uid: "",
      viewDetailList: {},
      agedContent: ""
    };
  },
  created() {
    this.uid = this.$route.query.id
    this.getNewsDetails(this.uid)
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    // 养老资讯详情
    getNewsDetails(val) {
      api
      .pensionInformation_v1_get(val)
      .then(res => {
        this.viewDetailList = res.datas
        if(this.viewDetailList.headImage) {
          this.agedContent = "has-image"
        }else {
          this.agedContent = "no-image"
        }
      })
      .catch(() => {
        this.$toast(constant.netErrMsg);
      })
    }
  }
};
</script>
<style lang="scss" scoped>
@import "../../styles/newsDetails.scss";
</style>